﻿using Corina.Datamodel.Base;
using Corina.Datamodel.Interface;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Corina.Datamodel.Entities
{
    [XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    public class RoleInfo : DatamodelEntity, IRole
    {
        #region Fields
        private int _id;
        private string _code;
        private string _name;
        private string _description;
        private bool _isAvailable = true;
        #endregion

        #region Properties
        public override string TableName
        {
            get
            {
                return "t_role";
            }
        }

        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged(() => Id);
            }
        }

        public string Code
        {
            get { return _code; }
            set
            {
                _code = value;
                RaisePropertyChanged(() => Code);
            }
        }
        
        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                RaisePropertyChanged(() => Name);
            }
        }
        
        public string Description
        {
            get { return _description; }
            set
            {
                _description = value;
                RaisePropertyChanged(() => Description);
            }
        }
        
        public bool IsAvailable
        {
            get { return _isAvailable; }
            set
            {
                _isAvailable = value;
                RaisePropertyChanged(() => IsAvailable);
            }
        }
        #endregion

        protected override IEnumerable<DatabaseColumn> InitColumns()
        {
            yield return new DatabaseColumn("Id", true);
            yield return new DatabaseColumn("Code", false, true);
            yield return new DatabaseColumn("Name");
            yield return new DatabaseColumn("Description");
            yield return new DatabaseColumn("IsAvailable");
        }
    }
}